/* @(#)GSManufactureAddAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-3-1
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.text.SimpleDateFormat;

import org.apache.commons.beanutils.BeanUtils;

import com.hitrust.gs.bean.GSManufactureBean;
import com.hitrust.gs.form.GSManufactureAddForm;
import com.hitrust.gs.form.GSManufactureScanQueryForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.business.GSManufactureProcessor;

/**
 * 增加产品信息
 */
public class GSManufactureAddAction extends GSBaseAction{

    /* (non-Javadoc)
     * @see com.hitrust.gs.service.GSBaseAction#execute(com.hitrust.gs.service.GSBaseForm)
     */
    public String execute(GSBaseForm aForm) throws Exception {
        GSManufactureAddForm tForm = (GSManufactureAddForm)aForm;
        
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String buf = df.format(new java.util.Date(System.currentTimeMillis()));
        
        GSManufactureBean tGSManufactureBean=new GSManufactureBean();
        BeanUtils.copyProperties(tGSManufactureBean,tForm);
        String tManuftype1=tForm.getManuftype1();
        String tManuftype2=tForm.getManuftype2();
        String tManuftype3=tForm.getManuftype3();
        //添加产品种类
         if(tManuftype2.equals("0")){
             tGSManufactureBean.setGs_manufacture_category_id(tManuftype1);
           }
           else if(tManuftype3.equals("0")){
             tGSManufactureBean.setGs_manufacture_category_id(tManuftype2);
              }
            else{
             tGSManufactureBean.setGs_manufacture_category_id(tManuftype3);
            }
        //添加是否交易平台
         tGSManufactureBean.setGs_is_tradeflat_manufacture("1");
         //产品录入时间
         tGSManufactureBean.setGs_manufacture_record_date(buf);
         //添加产品信息
         GSManufactureProcessor.addTask(tGSManufactureBean);
         
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
